﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="RolePermision.ascx.cs"
    Inherits="Portal.Administrator.Roles.RolePermision" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>
<table border="0" cellpadding="0" cellspacing="1" class="content" width="100%">
    <tr>
        <td class="postheader" width="40%" align="left" valign="top">
            <asp:UpdatePanel ID="upanelUserPermission" runat="server" UpdateMode="Conditional" RenderMode="Inline">
            <Triggers>
                <asp:asyncpostbacktrigger ControlID="btnUpdate" EventName="Click" />
                <asp:asyncpostbacktrigger ControlID="dropPortal" EventName="SelectedIndexChanged" />
                <asp:asyncpostbacktrigger ControlID="rdoRoles" EventName="SelectedIndexChanged" />
            </Triggers>
            <ContentTemplate>
                <table border="0" cellpadding="0" cellspacing="1" class="content" style="width: 100%">
                    <tr>
                        <td class="post" align="left">
                            Cổng&nbsp;:&nbsp;<asp:DropDownList ID="dropPortal" runat="server" DataTextField="Portal_Name" DataValueField="PortalID" AutoPostBack="True" Width="200px" OnSelectedIndexChanged="dropPortal_SelectedIndexChanged">
                            </asp:DropDownList></td>
                    </tr>
                    <tr>
                       <td class="post" align="left">
                            Roles&nbsp;:&nbsp;<asp:DropDownList ID="rdoRoles" runat="server" AutoPostBack="True" DataTextField="RoleName" DataValueField="RoleID" OnSelectedIndexChanged="rdoRoles_SelectedIndexChanged" >
                            </asp:DropDownList></td>
                    </tr>
                    <tr>
                        <td class="post" align="left">
                            <asp:ListBox ID="lstCommands" runat="server" Height="421px" SelectionMode="Multiple" Width="100%" ></asp:ListBox>                        
                        </td>
                    </tr>
                    <tr>
                        <td class="postfooter" align="center">
                            <asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click" Text="Cập nhật" CssClass="pbutton"  />&nbsp;<asp:Button ID="btnCancel" CssClass="pbutton" runat="server" Text="Hủy" OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            </asp:UpdatePanel>
        </td>
        <td class="post" width="60%" align="left" valign="top">
            <asp:UpdatePanel ID="upanelUserPermission1" runat="server" UpdateMode="Conditional" RenderMode="Inline">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnUpdate" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnUpdateAll" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="dropPortal" EventName="SelectedIndexChanged" />
                    <asp:AsyncPostBackTrigger ControlID="rdoRoles" EventName="SelectedIndexChanged" />
                </Triggers>
                <ContentTemplate>
                    <table border="0" cellpadding="0" cellspacing="1" class="content" style="width: 100%">
                    <tr>
                        <td class="header1" align="left">
                            <asp:Label ID="lblCommandName" runat="server"></asp:Label>
                        </td>
                    </tr>                
                    <tr>                    
                        <td valign="top" class="postheader" align="left"> 
                            <asp:DataGrid ID="dgrRolePermission" runat="server" AutoGenerateColumns="False" Width="100%" BorderColor="white"
                                OnItemCommand="dgrRolePermission_ItemCommand" OnItemDataBound="dgrRolePermission_ItemDataBound"
                                CellPadding="0">
                                <Columns>
                                    <asp:BoundColumn DataField="RoleID" Visible="False" />
                                    <asp:BoundColumn DataField="CommandID" Visible="False" />
                                    <asp:BoundColumn DataField="PortalID" Visible="False" />
                                    <asp:TemplateColumn>
                                        <ItemStyle HorizontalAlign="Left" />
                                        <HeaderStyle Width="50%" HorizontalAlign="Left" />
                                        <ItemTemplate>
                                            <asp:Label ID="lblCmdName" runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn HeaderText="Đọc">
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkView" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn HeaderText="Ghi">
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkAdd" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn HeaderText="Sửa">
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkEdit" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn HeaderText="Xóa">
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkDelete" runat="server" />
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                    <asp:TemplateColumn>
                                        <ItemStyle HorizontalAlign="Center" />
                                        <HeaderStyle Width="10%" HorizontalAlign="Center" />
                                        <ItemTemplate>
                                            <ImageButton:View runat="server" ID="btnUpdate" ToolTip="Update this !" CommandName="edit" ImageUrl="/Administrator/Resource/Images/Table/filesave.png" />
                                        </ItemTemplate>
                                    </asp:TemplateColumn>
                                </Columns>
                                <HeaderStyle HorizontalAlign="Center" CssClass="postfooter" Height="27" Font-Bold="true" />
                                <ItemStyle HorizontalAlign="Center" CssClass="postheader" Height="22" />
                                <AlternatingItemStyle HorizontalAlign="Center" CssClass="post" Height="22" />
                            </asp:DataGrid>
                        </td>
                    </tr>
                    <tr>
                        <td class="postfooter" valign="middle" align="left">
                            &nbsp;&nbsp;<asp:Button ID="btnUpdateAll" CssClass="Button" runat="server" Text="Cập nhật" OnClick="btnUpdateAll_Click" />&nbsp;<asp:Label ID="lblUpdateStatus" runat="server"></asp:Label></td>
                    </tr>
                </table>
                </ContentTemplate>                 
            </asp:UpdatePanel>            
        </td>
    </tr>   
</table>